package service.impl;

import dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.User;
import service.UserService;

import java.util.List;
@Service("userService")
public class UserServiceImpl implements UserService {


@Autowired
    UserDao userDao;


    @Override
    public List<User> findAll(User user, int offset, int pageSize) {
        return userDao.findAll(user,offset,pageSize);
    }

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public int deleteUser(int id) {
        return userDao.deleteUser(id);
    }

    @Override
    public User findUserById(int id) {
        return userDao.findUserById(id);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int getToalCount(User contion) {
        return userDao.getToalCount(contion);
    }

    @Override
    public boolean login(User user) {
         int result =userDao.login(user);
         if(result>0)
         { return true;}
         else
        {
          return false;
        }
    }
}
